package com.bite.spring.demo.pratice;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:
 * Date: 2025-11-06
 * Time: 16:13
 */

//告诉 Spring “当用户访问某个 URL 时，调用这个方法”。
@RequestMapping("/calc1")
@RestController
public class CalcController1 {
    @RequestMapping("/sum")
    public String sum(Integer num1, Integer num2){
        if(num1 == null || num2 == null){
            return "输入的参数有错误";
        }

        Integer sum = num1 + num2;
        return "<h1>计算机的结果为：" + sum + "<h1>";
    }
}
